package oop.java0322;

import java.util.Scanner;

public class MallTest {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        Mall mall = new Mall("大润发", "合肥");
        while (true) {
            System.out.println("******************************");
            System.out.println("1.查看商城信息\n2.添加新会员\n3.增加积分\n4.查看会员信息\n5.兑换礼品");
            System.out.println("******************************");
            System.out.print("请选择：(输入0退出)");
            int number = in.nextInt();
            switch (number) {
                case 1: {
                    mall.showMall();
                    break;
                }
                case 2: {
                    System.out.print("请输入卡号：");
                    String cardNo = in.next();
                    System.out.print("请输入姓名：");
                    String name = in.next();
                    System.out.print("请输入电话号码：");
                    String telePhone = in.next();
                    System.out.print("请输入初始积分：");
                    int score= in.nextInt();
                    Card card = new Card(cardNo, name, telePhone, score);
                    mall.add(card);
                    break;
                }
                case 3: {
                    System.out.print("请输入会员号:");
                    String cardNo = in.next();
                    System.out.print("请输入要增加的积分数:");
                    int score = in.nextInt();
                    mall.increaseScore(cardNo, score);
                    break;
                }
                case 4: {
                    mall.showInfo();
                    break;
                }
                case 5: {
                    System.out.println("***************************");
                    System.out.println("\t\t礼品清单\n1.100分兑换餐巾纸一包" +
                            "\n2.400分兑换剃须刀一把" +
                            "\n3.1000分兑换炒锅一个");
                    System.out.println("***************************");
                    System.out.print("请输入会员号：");
                    String cardNo = in.next();
                    System.out.print("请选择商品：");
                    int no = in.nextInt();
                    mall.exchange(cardNo, no);
                }
                default: {
                    break;
                }
            }
            if (number == 0) {
                System.out.println("退出！");
                break;
            }
        }
    }
}
